﻿<UserControl x:Class="RoutesAdministration.Views.TravelTimesAdministration"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:viewmodels="clr-namespace:RoutesAdministration.ViewModels"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <viewmodels:ViewModelMain x:Key="Main"/>
    </UserControl.Resources>
    <Grid>
        <StackPanel DataContext="{Binding Source={StaticResource Main}}">
            <StackPanel Orientation="Horizontal" Margin="4,0,0,0">
                <TextBlock Text="Departure Station" Width="110"/>
                <TextBlock Text="Arrival Station" Width="110"/>
                <TextBlock Text="Time" Width="50"/>
            </StackPanel>
            <ListView Name="TravelTimesList" ItemsSource="{Binding TravelTimes}">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <TextBox Text="{Binding Station1}" Width="110"/>
                            <TextBox Text="{Binding Station2}" Width="110"/>
                            <TextBox Text="{Binding Time}" Width="50"/>
                            <Button Content="Delete" DataContext="{Binding TravelTimeID}" Click="DeleteButton_Click"/>
                        </StackPanel>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
            <StackPanel Orientation="Horizontal" Margin="4,0,0,0">
                <TextBox Name="InsertStation1" Width="110"/>
                <TextBox Name="InsertStation2" Width="110"/>
                <TextBox Name="InsertTime" Width="50"/>
                <Button Content="Insert" Click="InsertButton_Click"/>
            </StackPanel>
            <Button x:Name="ButtonSave" MaxWidth="120" Command="{Binding SaveCommand}" Content="Save Changes!"/>
        </StackPanel>
    </Grid>
</UserControl>
